#pragma once

#include <iostream>
#include "../math/math.h"
#include <vector>
#include <map>
#include <cmath>
#include <assert.h>
#include <string>
#include <sstream>
#include <iomanip>
#include <cstdint> // 确保 byte 类型为 uint8_t

#define PI 3.14159265358979323
#define DEG2RAD(theta) (0.01745329251994329 * (theta))
#define FRACTION(v) ((v) - (int)(v))

using byte = unsigned char;

//Ubuntu的ARGB32为A-R-G-B，而Windows的BGRA为B-G-R-A。每个像素4字节，一个通道8位，1字节
//
struct RGBA
{
	byte mR;
	byte mG;
	byte mB;
	byte mA;

	RGBA(
		byte r = 255,
		byte g = 255,
		byte b = 255,
		byte a = 255)
	{
		mR = r;
		mG = g;
		mB = b;
		mA = a;
	}

    //window的默认像素格式
	uint32_t toBGRA() const
	{ 
		return (mB << 24) | (mG << 16) | (mR << 8) | mA;
	}

    //Ubuntu的默认像素格式
	uint32_t toARGB() const
	{ 
		return (mA << 24) | (mR << 16) | (mG << 8) | mB;
	}
};

struct Point
{
	int32_t x;
	int32_t y;
	RGBA color;
	math::vec2f uv;
};
#define TEXTURE_WRAP_REPEAT 0
#define TEXTURE_WRAP_MIRROR 1
#define ARRAY_BUFFER 0
#define ELEMENT_ARRAY_BUFFER 1

#define DRAW_LINES 0
#define DRAW_TRIANGLES 1